Loading
Scriptbox
 VBScript Links 
 About VBscript 
 JavaScript Links 
 About JavaScript 
 Powershell Links 
 PSCRIPT the Script Launcher 
 PowerShell Shortcut Keys 
 About Powershell 
     VBScript
    JavaScript
    Powershell
Disclaimer
Contact
Latest 10 Scripts
Script search
  :: { Category } :: 0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ
         

Search Options:  List  Real  Time  Events  in  a  Command  Window  

 Content of List Real Time Events in a Command Window.vbs
MD5 Hash: D68BD5837D674BEB8A7027625A08D17C
' Description: Creates a temporary event consumer that monitors the event log for error events. When an error event occurs, the script displays the event information in the command window.


strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Security)}!\\" & _
strComputer & "\root\cimv2")

Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
("Select * from __InstanceCreationEvent within 5 where TargetInstance " & _
isa 'Win32_NTLogEvent' and TargetInstance.EventType = '1'")

Do
Set objLatestEvent = colMonitoredEvents.NextEvent
Wscript.Echo "Record No.: " & _
objLatestEvent.TargetInstance.RecordNumber
Wscript.Echo "Event ID: " & objLatestEvent.TargetInstance.EventCode
Wscript.Echo "Time: " & objLatestEvent.TargetInstance.TimeWritten
Wscript.Echo "Source: " & objLatestEvent.TargetInstance.SourceName
Wscript.Echo "Category: " & _
objLatestEvent.TargetInstance.CategoryString
Wscript.Echo "Event Type: " & objLatestEvent.TargetInstance.Type
Wscript.Echo "Computer: " & _
objLatestEvent.TargetInstance.ComputerName
Wscript.Echo "User: " & objLatestEvent.TargetInstance.User
Wscript.echo "Text: " & objLatestEvent.TargetInstance.Message
Loop

   © 2008 - 2013 Boris Toll      :: Scripts available: 6.481 ::      :: scriptbox.toll.at ::      :: powered by www.toll.at ::
  Google Entries:n/a
  Yahoo Backlinks:n/a
  Live Backlinks:n/a
  del.icio.us Bookmarks:n/a
  Technorati Links:n/a